package com.yjk.controller;


import com.yjk.entity.Admin;
import com.yjk.entity.Baoguang;
import com.yjk.entity.News;
import com.yjk.service.IBaoguangService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author yjk
 * @since 2022-04-05
 */
@RestController
@RequestMapping("/baoguang")
public class BaoguangController {
    @Autowired
    private IBaoguangService bs;

    @GetMapping("/")
    public List<Baoguang> selectAll(){
        return bs.list();
    }
    @GetMapping("/selectId/{id}")
    public Baoguang selectAll(@PathVariable("id") int id){
        return bs.getById(id);
    }
    @DeleteMapping("/delete/{id}")
    public void deleteByid(@PathVariable("id") int id){
        bs.removeById(id);
    }
    @PostMapping("/add")
    public void add(@RequestBody Baoguang clazz){
        bs.updateById(clazz);
    }
    @PostMapping("/set")
    public void set(@RequestBody Baoguang clazz){
        bs.save(clazz);
    }
}

